/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.bugeden.netdisk.vfs;

import java.io.IOException;
import java.io.InputStream;
import javax.activation.FileDataSource;

/**
 *
 * @author bug-eden
 */
public class PartitionDataSource extends FileDataSource{

    private long begin;
    private long size;
    InputStream in = null;

    public PartitionDataSource(String file) throws IOException
    {
        super(file);
        begin = 0;
        in = new PartitionInputStream( super.getInputStream(),begin,size);
        size = super.getFile().length();
    }
    public PartitionDataSource(String file,long begin,long size) throws IOException
    {
        super(file);
        in = new PartitionInputStream( super.getInputStream(),begin,size);
        this.begin = begin;
        this.size = size;
    }

    @Override
    public InputStream getInputStream() throws IOException
    {

        return new PartitionInputStream(super.getInputStream(), begin, size);
    }



}
